**Dynamic NPC Density Adjuster**


### Description
The Dynamic NPC Density Adjuster mod dynamically adjusts the density of NPCs and vehicles in GTA V based on the in-game time and day of the week. This mod provides a more immersive and realistic gameplay experience by simulating real-world traffic patterns.

### Features
- Adjusts NPC and vehicle density based on the in-game hour.
- Special density settings for weekends (Saturday and Sunday).
- Smooth transitions between different times of the day.
- Lightweight and easy to install.

### How It Works
The mod monitors the in-game time and day of the week to determine the appropriate density settings. For instance, the mod simulates lighter traffic in the early morning and heavy traffic during peak hours. On weekends, the density is adjusted to reflect typical weekend traffic patterns.

### Installation
1. Download and install [Script Hook V](http://www.dev-c.com/gtav/scripthookv/).
2. Download and install [Script Hook V .NET](https://github.com/crosire/scripthookvdotnet/releases).
3. Place `DynamicNPCDensityAdjuster.dll` and `DynamicNPCDensityAdjuster.pdb` in your `scripts` folder within the GTA V directory. If you don't have a `scripts` folder, create one.
4. Launch GTA V and enjoy the mod!

### Usage
The mod automatically adjusts the NPC and vehicle density based on the in-game time and day of the week. You do not need to do anything once the mod is installed.

### Changelog
#### v1.0
- Initial release with dynamic density adjustment based on time and day.

#### **v2.0: New Version with Configurable Density via config.ini**
- Added support for customizable NPC density settings through `config.ini`.

- How to install: Place `DynamicNPCDensityAdjuster.dll`, `DynamicNPCDensityAdjuster.pdb`, and the `DynamicNPCDensityAdjuster` folder in the `scripts` directory inside the GTA V folder. If the `scripts` directory does not exist, create it. Note: The `DynamicNPCDensityAdjuster` folder contains the `config.ini` file.

- Location of `config.ini`: The config file must be located at `Grand Theft Auto V\Scripts\DynamicNPCDensityAdjusterWithConf\config.ini`.

- Explanation of `config.ini` setup:
    - `[Weekdays]`: This section configures NPC density for weekdays (Monday to Friday).
        ```
        [0~8] = 0.1   --> Sets NPC density from 12:00 AM to 8:00 AM to 0.1
        [8~10] = 1.4  --> Sets NPC density from 8:00 AM to 10:00 AM to 1.4
        [10~16] = 0.3 --> Sets NPC density from 10:00 AM to 4:00 PM to 0.3
        [16~18] = 1.5 --> Sets NPC density from 4:00 PM to 6:00 PM to 1.5
        [18~20] = 0.6 --> Sets NPC density from 6:00 PM to 8:00 PM to 0.6
        [20~0] = 0.2  --> Sets NPC density from 8:00 PM to 12:00 AM to 0.2
        ```

    - `[Weekends]`: This section configures NPC density for weekends (Saturday and Sunday).
        ```
        [0~8] = 0.1   --> Sets NPC density from 12:00 AM to 8:00 AM to 0.1
        [8~10] = 0.3  --> Sets NPC density from 8:00 AM to 10:00 AM to 0.3
        [10~16] = 0.5 --> Sets NPC density from 10:00 AM to 4:00 PM to 0.5
        [16~18] = 0.7 --> Sets NPC density from 4:00 PM to 6:00 PM to 0.7
        [18~20] = 0.8 --> Sets NPC density from 6:00 PM to 8:00 PM to 0.8
        [20~0] = 0.1  --> Sets NPC density from 8:00 PM to 12:00 AM to 0.1
        ```

- If you feel the time intervals are too sparse or too dense, you can freely adjust or add additional time ranges to suit your needs.

#### **v3.0: New Version with Configurable Density via config.ini**
- Optimized compatibility for GTA V's 12/10 Winter DLC update to prevent errors and ensure the mod remains functional.

#### **v4.0: Allow Separate Configuration for Vehicle and Pedestrian Density Parameters, and Add Comment Support in config.ini**
- Split the density parameters in the config.ini file into separate settings for vehicles and pedestrians, enabling players to customize their desired density parameters individually for more precise adjustments.
- Players can use the '#' symbol to add comments, making their configuration files more readable and organized.

### Credits
Developed by TheChun.

---


**動態人口密度自適應**

### 描述
動態人口密度自適應會根據GTA V中的遊戲時間動態調整NPC和車輛的密度。這個模組通過模擬現實世界的交通模式，提供更具沉浸感和現實感的遊戲體驗。

### 功能
- 根據遊戲中的小時與日期調整NPC和車輛的密度。
- 為區分平日與週末（星期六和星期日）提供額外的密度設定。
- 在不同的時間段之間平滑過渡。
- 輕量且易於安裝。

### 運作原理
模組監控遊戲中的時間和日期，以確定適當的密度設定。例如，模組會模擬清晨的稀少人流以及尖峰時段的繁忙交通。在週末，密度會調整以反映典型的週末交通模式。

### 安裝步驟
1. 下載並安裝 [Script Hook V](http://www.dev-c.com/gtav/scripthookv/)。
2. 下載並安裝 [Script Hook V .NET](https://github.com/crosire/scripthookvdotnet/releases)。
3. 將 `DynamicNPCDensityAdjuster.dll` 和 `DynamicNPCDensityAdjuster.pdb` 放置在GTA V目錄中的 `scripts` 資料夾內。如果你沒有 `scripts` 資料夾，請自行創建一個。
4. 啟動GTA V

### 使用說明
模組會根據遊戲中的時間和日期自動調整NPC和車輛的密度。一旦安裝完成，你無需進行任何操作，模組會自動運作

### 更新日誌
#### v1.0
- 初始版本，根據時間和日期進行動態密度調整。

#### **v2.0: 新版本，NPC密度支援config.ini進行客製化配置**
- 增加了透過 `config.ini` 自定義NPC密度的支援。

- 安裝說明：將 `DynamicNPCDensityAdjuster.dll`、`DynamicNPCDensityAdjuster.pdb` 以及 `DynamicNPCDensityAdjuster` 資料夾放入GTA V目錄中的 `scripts` 資料夾內。如果 `scripts` 資料夾不存在，請自行創建。注意：`DynamicNPCDensityAdjuster` 資料夾內含有 `config.ini` 文件。

- config.ini 的路徑：`config.ini` 文件必須放置於 `Grand Theft Auto V\Scripts\DynamicNPCDensityAdjusterWithConf\config.ini` 路徑下。

- config.ini 的設置說明：
    - `[Weekdays]`: 此部分設定平日（週一至週五）的NPC密度。
        ```
        [0~8] = 0.1   --> 設定0點至8點的NPC密度為0.1
        [8~10] = 1.4  --> 設定8點至10點的NPC密度為1.4
        [10~16] = 0.3 --> 設定10點至16點的NPC密度為0.3
        [16~18] = 1.5 --> 設定16點至18點的NPC密度為1.5
        [18~20] = 0.6 --> 設定18點至20點的NPC密度為0.6
        [20~0] = 0.2  --> 設定20點至0點的NPC密度為0.2
        ```

    - `[Weekends]`: 此部分設定週末（週六與週日）的NPC密度。
        ```
        [0~8] = 0.1   --> 設定0點至8點的NPC密度為0.1
        [8~10] = 0.3  --> 設定8點至10點的NPC密度為0.3
        [10~16] = 0.5 --> 設定10點至16點的NPC密度為0.5
        [16~18] = 0.7 --> 設定16點至18點的NPC密度為0.7
        [18~20] = 0.8 --> 設定18點至20點的NPC密度為0.8
        [20~0] = 0.1  --> 設定20點至0點的NPC密度為0.1
        ```

- 若覺得時間範圍太稀疏或太密集，可以自由調整或新增時間範圍以符合你的需求。

#### **v3.0: 為GTA V冬季DLC進行優化更新**
- 因應12/10的冬季DLC更新，提前進行維護與更新，確保模組穩定運作，避免可能的錯誤或失效問題。

#### **v4.0: 允許車輛與行人的密度參數個別設置，並新增config.ini的註解功能**
- 將congif.ini文件中的密度參數分割成車輛與行人，允許玩家個別客製化理想的密度參數，實現更精細的調整
- 玩家可透過#符號進行註解，讓自己的設置文檔更加清晰

### 致謝
由 TheChun 開發。

---